import React, { Component } from 'react'
import { Text, StyleSheet, View, Image, Dimensions,ScrollView } from 'react-native'
import Swiper from 'react-native-swiper'

export default class index extends Component {
  render() {
    return (
      <ScrollView style={[styles.ScrollView]}>
        <Swiper style={[styles.wrapper]}
            showsButtons={false} // 是否显示左右按钮
            autoplay={true} // 是否自动切换
            loop={true} // 是否循环播放
            index={0} // 初始显示的索引值
        >
            <Image
                style={[styles.slideImage]}
                source={{
                    uri: 'https://foruda.gitee.com/avatar/1723290893308622047/8841114_fs529_1723290893.png!avatar200',
                 }}
            />
            <Image
                style={[styles.slideImage]}
                source={{
                    uri: 'https://foruda.gitee.com/avatar/1723290893308622047/8841114_fs529_1723290893.png!avatar200',
                 }}
            />
            <Image
                style={[styles.slideImage]}
                source={{
                    uri: 'https://foruda.gitee.com/avatar/1723290893308622047/8841114_fs529_1723290893.png!avatar200',
                 }}
            />
            <Image
                style={[styles.slideImage]}
                source={{
                    uri: 'https://foruda.gitee.com/avatar/1723290893308622047/8841114_fs529_1723290893.png!avatar200',
                 }}
            />
        </Swiper>
      </ScrollView>
    )
  }
}

const styles = StyleSheet.create({
    ScrollView:{
       flex: 1,
       marginTop: Dimensions.get('window').height/2 - 180,
       marginLeft: 10,
       marginRight: 10,
    },
    wrapper:{
        height: 340,
    },
    slideImage:{
        height: 280,
        width: Dimensions.get('window').width,
    }
})
